<template>
	<el-form>
		<el-form-item label="我的名字">
			<el-input v-model.trim="user.name" readonly />
		</el-form-item>
		<el-form-item label="我的邮箱">
			<el-input v-model.trim="userEmail" readonly />
		</el-form-item>
		<el-form-item>
			<el-button type="primary" size="mini" @click="submit" disabled>修改</el-button>
		</el-form-item>
	</el-form>
</template>

<script>
import { departmentUser } from '@/api/productApi/fundManager'
export default {
	props: {
		user: {
			type: Object,
			default: () => {
				return {
					name: '',
					email: ''
				}
			}
		}
	},

	data() {
		return {
			userEmail: ''
		}
	},

	mounted() {
		this.getemail()
	},

	methods: {
		getemail() {
			departmentUser({ userCode: '2', userList: [] }).then(res => {
				const obj = res.data.body.filter(item => item.username === this.$store.getters.name)
				if (obj.length) {
					this.userEmail = obj[0].email
					this.user.name = obj[0].firstName
				}
			})
		},
		submit() {
			this.$message({
				message: '暂无此功能',
				type: 'warning',
				duration: 5 * 1000
			})
		}
	}
}
</script>
